﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Extensions;
using Abp.Linq.Extensions;
using AbpVueDemo.JichuxinxiDome.HuozhuDataManager.Dto;
using AbpVueDemo.JichuxinxinDemo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpVueDemo.JichuxinxiDome.HuozhuDataManager
{
    public class HuoDataService : AsyncCrudAppService<HuozhuData, HuoDataInputDto, int, PageHuoDataRequestDto, HuoDataCreateDto, HuoDataUpdataDto>, IHuoDataService
    {
        public HuoDataService(
      IRepository<HuozhuData, int> repository) : base(repository)
        {

        }

        // <summary>
        // 自定义分页条件查询, 需要重写父类的CreateFilteredQuery方法,让其进行自定义条件筛选
        // </summary>
        // <param name = "input" > 查询条件 </ param >
        // < returns ></ returns >
        protected override IQueryable<HuozhuData> CreateFilteredQuery(PageHuoDataRequestDto input)
        {
            return base.CreateFilteredQuery(input)//h_drivingdateend
                .WhereIf(!string.IsNullOrEmpty(input.h_cargoname), c => c.h_cargoname.Contains(input.h_cargoname))
                .WhereIf(!string.IsNullOrEmpty(input.h_phone), c => c.h_phone.Contains(input.h_phone));
              //  .WhereIf(!string.IsNullOrEmpty(input.h_drivingdateend, c => c.h_drivingdateend.Contains(input.h_drivingdateend.ToString()));
             // .WhereIf(!string.IsNullOrEmpty(input.h_drivingdateend.ToString()), c => c.h_drivingdateend == input.h_drivingdateend);
        }
       // protected override 
    }
}
